PHP

How to create a constant using define() function in PHP | PHP programs

How to create a constant using define() function in PHP | PHP programs

How to create a constant using define() function in PHP | PHP programs

We will create a PI constant using the define() function and calculate the area of the circle.

<?php


define(PI, 3.14);

$radius = 10;

$area = PI * $radius * $radius;

print ("Area of circle: " . $area);
?>
TutorialsLink Curator

This is an official account managed by the team TutorialsLink Community